package com.xiaolin.base.common;

/**
 * @ClassName Power01
 * @Description 次方
 * @Detail 判断一个数是不是2的次方
 * @Author MyPC
 * @Date 2020/7/23
 * @Version 1.0
 */
public class Power01 {
    public static void main(String[] args) {
        boolean judge = judge(5);
        System.out.println(judge);
    }
    public static boolean judge(int num){
        if(num <2){
            return false;
        }
        //注意，外层要使用括号括起来
        return (num &(num-1)) == 0;
    }
}
